    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Login with Facebook In CakePHP</title>
    <?php
    echo $this->Html->script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
    echo $this->Html->script('oauthpopup'); ?>
    <script type="text/javascript">
    $(document).ready(function(){
    $('#facebook').click(function(e){
    $.oauthpopup({
    path: 'login',
    width:600,
    height:300,
    callback: function(){
    window.location.reload();
    }
    });
    e.preventDefault();
    });
    });
    </script>
    </head>
    <body>
    <?php
    $ses_user=$this->Session->read('User');
    $logout=$this->Session->read('logout');
    if(!$this->Session->check('User') && empty($ses_user)) {
    echo $this->Html->image('facebook.png',array('id'=>'facebook','style'=>'cursor:pointer;float:left;margin-left:550px;'));
    } else{
     
    echo '<img src="https://graph.facebook.com/'. $ses_user['id'] .'/picture" width="30" height="30"/><div>'.$ses_user['name'].'</div>';
    echo '<a href="'.$logout.'">Logout</a>';
     
    }
    ?>
    </body>
    </html>